package com.res.share.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.res.share.model.ResArt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.res.share.model.dto.ArticleModel;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 资源 Mapper 接口
 * </p>
 *
 * @author astupidcoder
 * @since 2021-09-13
 */
public interface ResArtMapper extends BaseMapper<ResArt> {

    List<ArticleModel> findArtsList(@Param("userId") Integer userId, @Param("type") Integer type);

    IPage<ArticleModel> findHotArticleList(@Param("page") Page<ArticleModel> page,
                                           @Param("type") Integer type,
                                           @Param("userId") Integer userId,
                                           @Param("resType") Integer resType,
                                           @Param("cidList") List<Integer> cidList);

    /**
     * @param page
     * @param userId
     * @param keywords
     * @return
     */
    IPage<ArticleModel> searchArticleList(@Param("page") Page<ArticleModel> page, @Param("userId") Integer userId, @Param("keywords") String keywords);

    IPage<ArticleModel> findMyReports(@Param("page") Page<ArticleModel> page, @Param("userId") Integer userId);

    ArticleModel findArticleDetail(@Param("userId") Integer userId,
                                   @Param("articleId") Integer articleId,
                                   @Param("cId") Integer cId,
                                   @Param("selectType") Integer selectType,
                                   @Param("artType") Integer artType);

    List<ArticleModel> findLikeArticleList();


    List<ArticleModel> recommendArticleList(@Param("cidList") List<Integer> cidList,@Param("artType") Integer artType);

    String findArtUploadData(Integer articleId);

    void updateArticleLookSee(Integer articleId);

    IPage<ArticleModel> findTagArticleList(@Param("page") Page<ArticleModel> page, @Param("userId") Integer userId, @Param("tagId") Integer tagId);

    Integer findLeanResouceCount();

    List<ResArt> findLeanResouceList(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize);

    void updateResArt(@Param("delHTMLTag") String delHTMLTag, @Param("resName") String resName, @Param("id") Integer id);

    IPage<ArticleModel> findUserSHopResList(@Param("page")  Page<ArticleModel> page, @Param("userId")  Integer userId, @Param("beLongUserId")  Integer beLongUserId);
}
